package com.galudisu.handsonic.modules.system.service.impl;

import com.galudisu.handsonic.modules.system.dao.OrganizationDao;
import com.galudisu.handsonic.modules.system.dao.UserDao;
import com.galudisu.handsonic.modules.system.domain.Organization;
import com.galudisu.handsonic.modules.system.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author Barudisshu
 */
@Service
public class OrganizationServiceImpl implements OrganizationService {

    @Autowired
    @Qualifier("userDao")
    private UserDao userDao;

    @Autowired
    @Qualifier("organizationDao")
    private OrganizationDao organizationDao;

    @Override
    public Organization createOrganization(Organization organization) {
        return organizationDao.save(organization);
    }

    @Override
    public Organization updateOrganization(Organization organization) {
        return organizationDao.save(organization);
    }

    @Override
    public void deleteOrganization(String organizationId) {
        organizationDao.delete(organizationId);
    }

    @Override
    public Organization findOne(String organizationId) {
        return organizationDao.findOne(organizationId);
    }

    @Override
    public List<Organization> findAll() {
        return organizationDao.findAll();
    }

    @Override
    public List<Organization> findAllWithExclude(Organization excludeOrganization) {
        return organizationDao.findAllWithExclude(excludeOrganization);
    }

    @Override
    public void move(Organization source, Organization target) {
        organizationDao.move(source,target);
    }

    @Override
    public List<String> findWithContain(Collection<String> organizationIds) {
        return organizationDao.findWithContain(organizationIds);
    }
}
